# Create your models here.


from django.db import models

from utils.models import CoreModel


class gupiaoliebiao(CoreModel):
    ts_code = models.CharField(max_length=100, verbose_name="TS代码", )
    symbol = models.CharField(max_length=100, verbose_name="股票代码", db_index=True,
                              unique=True, default=None)
    name = models.CharField(max_length=100, verbose_name="股票名称", null=True)
    area = models.CharField(max_length=100, verbose_name="地域", null=True)
    industry = models.CharField(max_length=100, verbose_name="所属行业", null=True)
    fullname = models.CharField(max_length=100, verbose_name="股票全称", null=True)
    enname = models.CharField(max_length=100, verbose_name="英文全称", null=True)
    cnspell = models.CharField(max_length=100, verbose_name="拼音缩写", null=True)
    market = models.CharField(max_length=100, verbose_name="市场类型（主板/创业板/科创板/CDR）", null=True)
    exchange = models.CharField(max_length=100, verbose_name="交易所代码", null=True)
    curr_type = models.CharField(max_length=100, verbose_name="交易货币", null=True)
    list_status = models.CharField(max_length=100, verbose_name="上市状态 L上市 D退市 P暂停上市", null=True)
    list_date = models.CharField(max_length=100, verbose_name="上市日期", null=True)
    delist_date = models.CharField(max_length=100, verbose_name="退市日期", null=True)
    is_hs = models.CharField(max_length=100, verbose_name="是否沪深港通标的，N否 H沪股通 S深股通", null=True)
    act_name = models.CharField(max_length=100, verbose_name="实控人名称", null=True)
    act_ent_type = models.CharField(max_length=100, verbose_name="实控人企业性质", null=True)
    l1_code = models.CharField(max_length=100, verbose_name="一级行业代码", null=True)
    l1_name = models.CharField(max_length=100, verbose_name="一级行业名称", null=True)
    l2_code = models.CharField(max_length=100, verbose_name="二级行业代码", null=True)
    l2_name = models.CharField(max_length=100, verbose_name="二级行业名称", null=True)
    l3_code = models.CharField(max_length=100, verbose_name="三级行业代码", null=True)
    l3_name = models.CharField(max_length=100, verbose_name="三级行业名称", null=True)

    class Meta:
        app_label = 'gupiaoliebiao'
        db_table = 'tb_gupiaoliebiao'
        verbose_name = "股票列表"
        verbose_name_plural = verbose_name
        # constraints = [
        #     models.UniqueConstraint(
        #         fields=['trace_date', 'ts_code'],  # 联合字段
        #         name='unique_trace_date_ts_code'  # 约束名称（需唯一）
        #     )
        # ]
